import { i18n } from '@/common/utils';
import { RJSFSchema } from '@rjsf/utils';

export const numberJsonData: RJSFSchema = {
  if: {
    properties: {
      Tabs: { const: 'Number' },
    },
  },
  then: {
    properties: {
      Selection: {
        type: 'object',
        title: i18n.t('Selection'),
        properties: {
          source: {
            title: i18n.t('Source'),
            type: 'array',
            ...{
              'x-options': ['line'],
            },
          },
        },
      },
      DistributionOptions: {
        type: 'object',
        title: i18n.t('Distribution Options'),
        properties: {
          biasing: {
            title: i18n.t('Biasing'),
            type: 'string',
            default: 'None',
            oneOf: [
              {
                const: 'None',
                title: i18n.t('None'),
              },
              {
                const: 'BellCurve',
                title: i18n.t('Bell Curve'),
              },
              {
                const: 'Linear',
                title: i18n.t('Linear'),
              },
              {
                const: 'Exponential',
                title: i18n.t('Exponential'),
              },
            ],
          },
          number: {
            title: i18n.t('Number'),
            type: 'number',
            default: 10,
          },
        },
        allOf: [
          {
            if: {
              properties: {
                biasing: { enum: ['Linear', 'Exponential', 'BellCurve'] },
              },
            },
            then: {
              properties: {
                factor: {
                  title: i18n.t('Factor'),
                  type: 'number',
                  default: 10,
                },
              },
            },
          },
        ],
      },
      reverseDirection: {
        title: i18n.t('Reverse Direction'),
        type: 'boolean',
      },
    },
  },
};
